<template>
	<view class="">
		<navbar :title="i18n.cjqb"></navbar>
		<view class="">
			<text class="w690 auto f14 white mt15 block">{{ i18n.qbmc }}</text>
			<input type="text" value="" class="w690 h96 bgcc f14 auto index my15 bor10" :placeholder="i18n.qsrqbmc" placeholder-class="color-gray" v-model="walletName" maxlength="15"/>
		</view>
		<view class="">
			<text class="w690 auto f14 white mt15 block">{{ i18n.aqmm }}</text>
			<view class="fcc auto bor10 mt15 py15 bgcc mx15 px15">
				<input :password="!eyestate" value="" class="flex-1 f14" :placeholder="i18n.qsraqmm" placeholder-class="color-gray" v-model="pws" maxlength="6"/>
				<image :src="eyestate?'../../static/login/eye1.png':'../../static/login/eye2.png'" @click="eyesin(0)"
					class="eyes"></image>
			</view>
			<view class="fcc auto bor10 mt10 py15 bgcc mx15 px15">
				<input :password="!comfirmstate" value="" class="flex-1 f14" :placeholder="i18n.qqraqmm" placeholder-class="color-gray" v-model="pwss" maxlength="6"/>
				<image :src="comfirmstate?'../../static/login/eye1.png':'../../static/login/eye2.png'" @click="eyesin(1)"
					class="eyes"></image>
			</view>
		</view>
		<view class="">
			<text class="w690 auto f14 white mt15 block">{{i18n.yqma}}</text>
			<input type="text" value="" class="w690 h96 bgcc f14 auto index my15 bor10" :placeholder="i18n.qsryqm" placeholder-class="color-gray" v-model="vcode"/>
		</view>
		<view class="bg-theme text--center color-white bor5 py11 auto mt30 w690" @click="Totranscribe()">{{i18n.xyb}}</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			walletName:'',
			pws:'',
			pwss:'',
			vcode:'',
			eyestate:false,
			comfirmstate:false,
		};
	},
	computed: {
		i18n() {
			return this.$t('login');
		}
	},
	onShow(){
		console.log(this.UID)
	},
	methods: {
		eyesin(index){
			if(index==0){
				this.eyestate = !this.eyestate
			}else{
				this.comfirmstate = !this.comfirmstate
			}
		},
		Totranscribe() {
			if(this.walletName == '' || [...this.walletName].length > 16){
				uni.showToast({
					title:this.$t('tips').mctips,
					icon:'none'
				})
				return false
			}
			if(this.pws == '' || [...this.pws].length != 6 || !/^\d*$/.test(this.pws)){
				uni.showToast({
					title:this.$t('tips').mmtips,
					icon:'none'
				})
				return false
			}
			if(this.pws != this.pwss){
				uni.showToast({
					title:this.$t('tips').mmbyz,
					icon:'none'
				})
				return false
			}
			if(!this.vcode){
				uni.showToast({
					title:this.$t('login').qsryqm,
					icon:'none'
				})
				return 
			}
			this.getMemo()
		},
		async getMemo(){
			let params = {
				phoneId:this.UID,
				walletName:this.walletName,
				passworld:this.pws,
				confirmPassworld:this.pwss,
				inviteCode:this.vcode
			}
			console.log(JSON.stringify(params))
			let { data } = await this.$http.post('login.getMemo', params, { isAuth: false, tipConfig: { isLoading: false } })
			uni.navigateTo({
				url: './transcribe?Memo='+data
			});
		},
		
		
		getDeviceInfo(){
			let that = this
			plus.device.getInfo({
				success:function(e){
					that.UID = e.uuid
				},
				fail:function(e){
					that.UID = e.uuid
				}
			});
		}
	}
};
</script>

<style lang="less">
.eyes{
	width: 34rpx;
	height: 34rpx;
}
</style>
